<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - code analysis - /usr/include/c++/5/bits/stl_queue.h</title>
  <link rel="stylesheet" type="text/css" href="../../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../../index.html">top level</a> - <a href="index.html">usr/include/c++/5/bits</a> - stl_queue.h<span style="font-size: 80%;"> (source / <a href="stl_queue.h.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">code analysis</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">4</td>
            <td class="headerCovTableEntry">4</td>
            <td class="headerCovTableEntryHi">100.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2020-09-11 22:25:26</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntryHi">-</td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : // Queue implementation -*- C++ -*-</a>
<span class="lineNum">       2 </span>            : 
<span class="lineNum">       3 </span>            : // Copyright (C) 2001-2015 Free Software Foundation, Inc.
<span class="lineNum">       4 </span>            : //
<span class="lineNum">       5 </span>            : // This file is part of the GNU ISO C++ Library.  This library is free
<span class="lineNum">       6 </span>            : // software; you can redistribute it and/or modify it under the
<span class="lineNum">       7 </span>            : // terms of the GNU General Public License as published by the
<span class="lineNum">       8 </span>            : // Free Software Foundation; either version 3, or (at your option)
<span class="lineNum">       9 </span>            : // any later version.
<span class="lineNum">      10 </span>            : 
<span class="lineNum">      11 </span>            : // This library is distributed in the hope that it will be useful,
<span class="lineNum">      12 </span>            : // but WITHOUT ANY WARRANTY; without even the implied warranty of
<span class="lineNum">      13 </span>            : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
<span class="lineNum">      14 </span>            : // GNU General Public License for more details.
<span class="lineNum">      15 </span>            : 
<span class="lineNum">      16 </span>            : // Under Section 7 of GPL version 3, you are granted additional
<span class="lineNum">      17 </span>            : // permissions described in the GCC Runtime Library Exception, version
<span class="lineNum">      18 </span>            : // 3.1, as published by the Free Software Foundation.
<span class="lineNum">      19 </span>            : 
<span class="lineNum">      20 </span>            : // You should have received a copy of the GNU General Public License and
<span class="lineNum">      21 </span>            : // a copy of the GCC Runtime Library Exception along with this program;
<span class="lineNum">      22 </span>            : // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
<span class="lineNum">      23 </span>            : // &lt;http://www.gnu.org/licenses/&gt;.
<span class="lineNum">      24 </span>            : 
<span class="lineNum">      25 </span>            : /*
<span class="lineNum">      26 </span>            :  *
<span class="lineNum">      27 </span>            :  * Copyright (c) 1994
<span class="lineNum">      28 </span>            :  * Hewlett-Packard Company
<span class="lineNum">      29 </span>            :  *
<span class="lineNum">      30 </span>            :  * Permission to use, copy, modify, distribute and sell this software
<span class="lineNum">      31 </span>            :  * and its documentation for any purpose is hereby granted without fee,
<span class="lineNum">      32 </span>            :  * provided that the above copyright notice appear in all copies and
<span class="lineNum">      33 </span>            :  * that both that copyright notice and this permission notice appear
<span class="lineNum">      34 </span>            :  * in supporting documentation.  Hewlett-Packard Company makes no
<span class="lineNum">      35 </span>            :  * representations about the suitability of this software for any
<span class="lineNum">      36 </span>            :  * purpose.  It is provided &quot;as is&quot; without express or implied warranty.
<span class="lineNum">      37 </span>            :  *
<span class="lineNum">      38 </span>            :  *
<span class="lineNum">      39 </span>            :  * Copyright (c) 1996,1997
<span class="lineNum">      40 </span>            :  * Silicon Graphics Computer Systems, Inc.
<span class="lineNum">      41 </span>            :  *
<span class="lineNum">      42 </span>            :  * Permission to use, copy, modify, distribute and sell this software
<span class="lineNum">      43 </span>            :  * and its documentation for any purpose is hereby granted without fee,
<span class="lineNum">      44 </span>            :  * provided that the above copyright notice appear in all copies and
<span class="lineNum">      45 </span>            :  * that both that copyright notice and this permission notice appear
<span class="lineNum">      46 </span>            :  * in supporting documentation.  Silicon Graphics makes no
<span class="lineNum">      47 </span>            :  * representations about the suitability of this software for any
<span class="lineNum">      48 </span>            :  * purpose.  It is provided &quot;as is&quot; without express or implied warranty.
<span class="lineNum">      49 </span>            :  */
<span class="lineNum">      50 </span>            : 
<span class="lineNum">      51 </span>            : /** @file bits/stl_queue.h
<span class="lineNum">      52 </span>            :  *  This is an internal header file, included by other library headers.
<span class="lineNum">      53 </span>            :  *  Do not attempt to use it directly. @headername{queue}
<span class="lineNum">      54 </span>            :  */
<span class="lineNum">      55 </span>            : 
<span class="lineNum">      56 </span>            : #ifndef _STL_QUEUE_H
<span class="lineNum">      57 </span>            : #define _STL_QUEUE_H 1
<span class="lineNum">      58 </span>            : 
<span class="lineNum">      59 </span>            : #include &lt;bits/concept_check.h&gt;
<span class="lineNum">      60 </span>            : #include &lt;debug/debug.h&gt;
<span class="lineNum">      61 </span>            : #if __cplusplus &gt;= 201103L
<span class="lineNum">      62 </span>            : # include &lt;bits/uses_allocator.h&gt;
<span class="lineNum">      63 </span>            : #endif
<span class="lineNum">      64 </span>            : 
<span class="lineNum">      65 </span>            : namespace std _GLIBCXX_VISIBILITY(default)
<span class="lineNum">      66 </span>            : {
<span class="lineNum">      67 </span>            : _GLIBCXX_BEGIN_NAMESPACE_VERSION
<span class="lineNum">      68 </span>            : 
<span class="lineNum">      69 </span>            :   /**
<span class="lineNum">      70 </span>            :    *  @brief  A standard container giving FIFO behavior.
<span class="lineNum">      71 </span>            :    *
<span class="lineNum">      72 </span>            :    *  @ingroup sequences
<span class="lineNum">      73 </span>            :    *
<span class="lineNum">      74 </span>            :    *  @tparam _Tp  Type of element.
<span class="lineNum">      75 </span>            :    *  @tparam _Sequence  Type of underlying sequence, defaults to deque&lt;_Tp&gt;.
<span class="lineNum">      76 </span>            :    *
<span class="lineNum">      77 </span>            :    *  Meets many of the requirements of a
<span class="lineNum">      78 </span>            :    *  &lt;a href=&quot;tables.html#65&quot;&gt;container&lt;/a&gt;,
<span class="lineNum">      79 </span>            :    *  but does not define anything to do with iterators.  Very few of the
<span class="lineNum">      80 </span>            :    *  other standard container interfaces are defined.
<span class="lineNum">      81 </span>            :    *
<span class="lineNum">      82 </span>            :    *  This is not a true container, but an @e adaptor.  It holds another
<span class="lineNum">      83 </span>            :    *  container, and provides a wrapper interface to that container.  The
<span class="lineNum">      84 </span>            :    *  wrapper is what enforces strict first-in-first-out %queue behavior.
<span class="lineNum">      85 </span>            :    *
<span class="lineNum">      86 </span>            :    *  The second template parameter defines the type of the underlying
<span class="lineNum">      87 </span>            :    *  sequence/container.  It defaults to std::deque, but it can be any type
<span class="lineNum">      88 </span>            :    *  that supports @c front, @c back, @c push_back, and @c pop_front,
<span class="lineNum">      89 </span>            :    *  such as std::list or an appropriate user-defined type.
<span class="lineNum">      90 </span>            :    *
<span class="lineNum">      91 </span>            :    *  Members not found in @a normal containers are @c container_type,
<span class="lineNum">      92 </span>            :    *  which is a typedef for the second Sequence parameter, and @c push and
<span class="lineNum">      93 </span>            :    *  @c pop, which are standard %queue/FIFO operations.
<span class="lineNum">      94 </span>            :   */
<span class="lineNum">      95 </span>            :   template&lt;typename _Tp, typename _Sequence = deque&lt;_Tp&gt; &gt;
<span class="lineNum">      96 </span><span class="lineCov">          2 :     class queue</span>
<span class="lineNum">      97 </span>            :     {
<span class="lineNum">      98 </span>            :       // concept requirements
<span class="lineNum">      99 </span>            :       typedef typename _Sequence::value_type _Sequence_value_type;
<span class="lineNum">     100 </span>            :       __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
<span class="lineNum">     101 </span>            :       __glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept)
<span class="lineNum">     102 </span>            :       __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
<span class="lineNum">     103 </span>            :       __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
<span class="lineNum">     104 </span>            : 
<span class="lineNum">     105 </span>            :       template&lt;typename _Tp1, typename _Seq1&gt;
<span class="lineNum">     106 </span>            :         friend bool
<span class="lineNum">     107 </span>            :         operator==(const queue&lt;_Tp1, _Seq1&gt;&amp;, const queue&lt;_Tp1, _Seq1&gt;&amp;);
<span class="lineNum">     108 </span>            : 
<span class="lineNum">     109 </span>            :       template&lt;typename _Tp1, typename _Seq1&gt;
<span class="lineNum">     110 </span>            :         friend bool
<span class="lineNum">     111 </span>            :         operator&lt;(const queue&lt;_Tp1, _Seq1&gt;&amp;, const queue&lt;_Tp1, _Seq1&gt;&amp;);
<span class="lineNum">     112 </span>            : 
<span class="lineNum">     113 </span>            :     public:
<span class="lineNum">     114 </span>            :       typedef typename _Sequence::value_type                value_type;
<span class="lineNum">     115 </span>            :       typedef typename _Sequence::reference                 reference;
<span class="lineNum">     116 </span>            :       typedef typename _Sequence::const_reference           const_reference;
<span class="lineNum">     117 </span>            :       typedef typename _Sequence::size_type                 size_type;
<span class="lineNum">     118 </span>            :       typedef          _Sequence                            container_type;
<span class="lineNum">     119 </span>            : 
<span class="lineNum">     120 </span>            :     protected:
<span class="lineNum">     121 </span>            :       /**
<span class="lineNum">     122 </span>            :        *  'c' is the underlying container.  Maintainers wondering why
<span class="lineNum">     123 </span>            :        *  this isn't uglified as per style guidelines should note that
<span class="lineNum">     124 </span>            :        *  this name is specified in the standard, [23.2.3.1].  (Why?
<span class="lineNum">     125 </span>            :        *  Presumably for the same reason that it's protected instead
<span class="lineNum">     126 </span>            :        *  of private: to allow derivation.  But none of the other
<span class="lineNum">     127 </span>            :        *  containers allow for derivation.  Odd.)
<span class="lineNum">     128 </span>            :        */
<span class="lineNum">     129 </span>            :       _Sequence c;
<span class="lineNum">     130 </span>            : 
<span class="lineNum">     131 </span>            :     public:
<span class="lineNum">     132 </span>            :       /**
<span class="lineNum">     133 </span>            :        *  @brief  Default constructor creates no elements.
<span class="lineNum">     134 </span>            :        */
<span class="lineNum">     135 </span>            : #if __cplusplus &lt; 201103L
<span class="lineNum">     136 </span>            :       explicit
<span class="lineNum">     137 </span>            :       queue(const _Sequence&amp; __c = _Sequence())
<span class="lineNum">     138 </span><span class="lineCov">          2 :       : c(__c) { }</span>
<span class="lineNum">     139 </span>            : #else
<span class="lineNum">     140 </span>            :       explicit
<span class="lineNum">     141 </span>            :       queue(const _Sequence&amp; __c)
<span class="lineNum">     142 </span>            :       : c(__c) { }
<span class="lineNum">     143 </span>            : 
<span class="lineNum">     144 </span>            :       explicit
<span class="lineNum">     145 </span>            :       queue(_Sequence&amp;&amp; __c = _Sequence())
<span class="lineNum">     146 </span>            :       : c(std::move(__c)) { }
<span class="lineNum">     147 </span>            : #endif
<span class="lineNum">     148 </span>            : 
<span class="lineNum">     149 </span>            :       /**
<span class="lineNum">     150 </span>            :        *  Returns true if the %queue is empty.
<span class="lineNum">     151 </span>            :        */
<span class="lineNum">     152 </span>            :       bool
<span class="lineNum">     153 </span>            :       empty() const
<span class="lineNum">     154 </span>            :       { return c.empty(); }
<span class="lineNum">     155 </span>            : 
<span class="lineNum">     156 </span>            :       /**  Returns the number of elements in the %queue.  */
<span class="lineNum">     157 </span>            :       size_type
<span class="lineNum">     158 </span>            :       size() const
<span class="lineNum">     159 </span>            :       { return c.size(); }
<span class="lineNum">     160 </span>            : 
<span class="lineNum">     161 </span>            :       /**
<span class="lineNum">     162 </span>            :        *  Returns a read/write reference to the data at the first
<span class="lineNum">     163 </span>            :        *  element of the %queue.
<span class="lineNum">     164 </span>            :        */
<span class="lineNum">     165 </span>            :       reference
<span class="lineNum">     166 </span>            :       front()
<span class="lineNum">     167 </span>            :       {
<span class="lineNum">     168 </span>            :         __glibcxx_requires_nonempty();
<span class="lineNum">     169 </span>            :         return c.front();
<span class="lineNum">     170 </span>            :       }
<span class="lineNum">     171 </span>            : 
<span class="lineNum">     172 </span>            :       /**
<span class="lineNum">     173 </span>            :        *  Returns a read-only (constant) reference to the data at the first
<span class="lineNum">     174 </span>            :        *  element of the %queue.
<span class="lineNum">     175 </span>            :        */
<span class="lineNum">     176 </span>            :       const_reference
<span class="lineNum">     177 </span>            :       front() const
<span class="lineNum">     178 </span>            :       {
<span class="lineNum">     179 </span>            :         __glibcxx_requires_nonempty();
<span class="lineNum">     180 </span>            :         return c.front();
<span class="lineNum">     181 </span>            :       }
<span class="lineNum">     182 </span>            : 
<span class="lineNum">     183 </span>            :       /**
<span class="lineNum">     184 </span>            :        *  Returns a read/write reference to the data at the last
<span class="lineNum">     185 </span>            :        *  element of the %queue.
<span class="lineNum">     186 </span>            :        */
<span class="lineNum">     187 </span>            :       reference
<span class="lineNum">     188 </span>            :       back()
<span class="lineNum">     189 </span>            :       {
<span class="lineNum">     190 </span>            :         __glibcxx_requires_nonempty();
<span class="lineNum">     191 </span>            :         return c.back();
<span class="lineNum">     192 </span>            :       }
<span class="lineNum">     193 </span>            : 
<span class="lineNum">     194 </span>            :       /**
<span class="lineNum">     195 </span>            :        *  Returns a read-only (constant) reference to the data at the last
<span class="lineNum">     196 </span>            :        *  element of the %queue.
<span class="lineNum">     197 </span>            :        */
<span class="lineNum">     198 </span>            :       const_reference
<span class="lineNum">     199 </span>            :       back() const
<span class="lineNum">     200 </span>            :       {
<span class="lineNum">     201 </span>            :         __glibcxx_requires_nonempty();
<span class="lineNum">     202 </span>            :         return c.back();
<span class="lineNum">     203 </span>            :       }
<span class="lineNum">     204 </span>            : 
<span class="lineNum">     205 </span>            :       /**
<span class="lineNum">     206 </span>            :        *  @brief  Add data to the end of the %queue.
<span class="lineNum">     207 </span>            :        *  @param  __x  Data to be added.
<span class="lineNum">     208 </span>            :        *
<span class="lineNum">     209 </span>            :        *  This is a typical %queue operation.  The function creates an
<span class="lineNum">     210 </span>            :        *  element at the end of the %queue and assigns the given data
<span class="lineNum">     211 </span>            :        *  to it.  The time complexity of the operation depends on the
<span class="lineNum">     212 </span>            :        *  underlying sequence.
<span class="lineNum">     213 </span>            :        */
<span class="lineNum">     214 </span>            :       void
<span class="lineNum">     215 </span>            :       push(const value_type&amp; __x)
<span class="lineNum">     216 </span><span class="lineCov">        206 :       { c.push_back(__x); }</span>
<span class="lineNum">     217 </span>            : 
<span class="lineNum">     218 </span>            : #if __cplusplus &gt;= 201103L
<span class="lineNum">     219 </span>            :       void
<span class="lineNum">     220 </span>            :       push(value_type&amp;&amp; __x)
<span class="lineNum">     221 </span>            :       { c.push_back(std::move(__x)); }
<span class="lineNum">     222 </span>            : 
<span class="lineNum">     223 </span>            :       template&lt;typename... _Args&gt;
<span class="lineNum">     224 </span>            :         void
<span class="lineNum">     225 </span>            :         emplace(_Args&amp;&amp;... __args)
<span class="lineNum">     226 </span>            :         { c.emplace_back(std::forward&lt;_Args&gt;(__args)...); }
<span class="lineNum">     227 </span>            : #endif
<span class="lineNum">     228 </span>            : 
<span class="lineNum">     229 </span>            :       /**
<span class="lineNum">     230 </span>            :        *  @brief  Removes first element.
<span class="lineNum">     231 </span>            :        *
<span class="lineNum">     232 </span>            :        *  This is a typical %queue operation.  It shrinks the %queue by one.
<span class="lineNum">     233 </span>            :        *  The time complexity of the operation depends on the underlying
<span class="lineNum">     234 </span>            :        *  sequence.
<span class="lineNum">     235 </span>            :        *
<span class="lineNum">     236 </span>            :        *  Note that no data is returned, and if the first element's
<span class="lineNum">     237 </span>            :        *  data is needed, it should be retrieved before pop() is
<span class="lineNum">     238 </span>            :        *  called.
<span class="lineNum">     239 </span>            :        */
<span class="lineNum">     240 </span>            :       void
<span class="lineNum">     241 </span>            :       pop()
<span class="lineNum">     242 </span>            :       {
<span class="lineNum">     243 </span>            :         __glibcxx_requires_nonempty();
<span class="lineNum">     244 </span><span class="lineCov">        203 :         c.pop_front();</span>
<span class="lineNum">     245 </span>            :       }
<span class="lineNum">     246 </span>            : 
<span class="lineNum">     247 </span>            : #if __cplusplus &gt;= 201103L
<span class="lineNum">     248 </span>            :       void
<span class="lineNum">     249 </span>            :       swap(queue&amp; __q)
<span class="lineNum">     250 </span>            :       noexcept(noexcept(swap(c, __q.c)))
<span class="lineNum">     251 </span>            :       {
<span class="lineNum">     252 </span>            :         using std::swap;
<span class="lineNum">     253 </span>            :         swap(c, __q.c);
<span class="lineNum">     254 </span>            :       }
<span class="lineNum">     255 </span>            : #endif
<span class="lineNum">     256 </span>            :     };
<span class="lineNum">     257 </span>            : 
<span class="lineNum">     258 </span>            :   /**
<span class="lineNum">     259 </span>            :    *  @brief  Queue equality comparison.
<span class="lineNum">     260 </span>            :    *  @param  __x  A %queue.
<span class="lineNum">     261 </span>            :    *  @param  __y  A %queue of the same type as @a __x.
<span class="lineNum">     262 </span>            :    *  @return  True iff the size and elements of the queues are equal.
<span class="lineNum">     263 </span>            :    *
<span class="lineNum">     264 </span>            :    *  This is an equivalence relation.  Complexity and semantics depend on the
<span class="lineNum">     265 </span>            :    *  underlying sequence type, but the expected rules are:  this relation is
<span class="lineNum">     266 </span>            :    *  linear in the size of the sequences, and queues are considered equivalent
<span class="lineNum">     267 </span>            :    *  if their sequences compare equal.
<span class="lineNum">     268 </span>            :   */
<span class="lineNum">     269 </span>            :   template&lt;typename _Tp, typename _Seq&gt;
<span class="lineNum">     270 </span>            :     inline bool
<span class="lineNum">     271 </span>            :     operator==(const queue&lt;_Tp, _Seq&gt;&amp; __x, const queue&lt;_Tp, _Seq&gt;&amp; __y)
<span class="lineNum">     272 </span>            :     { return __x.c == __y.c; }
<span class="lineNum">     273 </span>            : 
<span class="lineNum">     274 </span>            :   /**
<span class="lineNum">     275 </span>            :    *  @brief  Queue ordering relation.
<span class="lineNum">     276 </span>            :    *  @param  __x  A %queue.
<span class="lineNum">     277 </span>            :    *  @param  __y  A %queue of the same type as @a x.
<span class="lineNum">     278 </span>            :    *  @return  True iff @a __x is lexicographically less than @a __y.
<span class="lineNum">     279 </span>            :    *
<span class="lineNum">     280 </span>            :    *  This is an total ordering relation.  Complexity and semantics
<span class="lineNum">     281 </span>            :    *  depend on the underlying sequence type, but the expected rules
<span class="lineNum">     282 </span>            :    *  are: this relation is linear in the size of the sequences, the
<span class="lineNum">     283 </span>            :    *  elements must be comparable with @c &lt;, and
<span class="lineNum">     284 </span>            :    *  std::lexicographical_compare() is usually used to make the
<span class="lineNum">     285 </span>            :    *  determination.
<span class="lineNum">     286 </span>            :   */
<span class="lineNum">     287 </span>            :   template&lt;typename _Tp, typename _Seq&gt;
<span class="lineNum">     288 </span>            :     inline bool
<span class="lineNum">     289 </span>            :     operator&lt;(const queue&lt;_Tp, _Seq&gt;&amp; __x, const queue&lt;_Tp, _Seq&gt;&amp; __y)
<span class="lineNum">     290 </span>            :     { return __x.c &lt; __y.c; }
<span class="lineNum">     291 </span>            : 
<span class="lineNum">     292 </span>            :   /// Based on operator==
<span class="lineNum">     293 </span>            :   template&lt;typename _Tp, typename _Seq&gt;
<span class="lineNum">     294 </span>            :     inline bool
<span class="lineNum">     295 </span>            :     operator!=(const queue&lt;_Tp, _Seq&gt;&amp; __x, const queue&lt;_Tp, _Seq&gt;&amp; __y)
<span class="lineNum">     296 </span>            :     { return !(__x == __y); }
<span class="lineNum">     297 </span>            : 
<span class="lineNum">     298 </span>            :   /// Based on operator&lt;
<span class="lineNum">     299 </span>            :   template&lt;typename _Tp, typename _Seq&gt;
<span class="lineNum">     300 </span>            :     inline bool
<span class="lineNum">     301 </span>            :     operator&gt;(const queue&lt;_Tp, _Seq&gt;&amp; __x, const queue&lt;_Tp, _Seq&gt;&amp; __y)
<span class="lineNum">     302 </span>            :     { return __y &lt; __x; }
<span class="lineNum">     303 </span>            : 
<span class="lineNum">     304 </span>            :   /// Based on operator&lt;
<span class="lineNum">     305 </span>            :   template&lt;typename _Tp, typename _Seq&gt;
<span class="lineNum">     306 </span>            :     inline bool
<span class="lineNum">     307 </span>            :     operator&lt;=(const queue&lt;_Tp, _Seq&gt;&amp; __x, const queue&lt;_Tp, _Seq&gt;&amp; __y)
<span class="lineNum">     308 </span>            :     { return !(__y &lt; __x); }
<span class="lineNum">     309 </span>            : 
<span class="lineNum">     310 </span>            :   /// Based on operator&lt;
<span class="lineNum">     311 </span>            :   template&lt;typename _Tp, typename _Seq&gt;
<span class="lineNum">     312 </span>            :     inline bool
<span class="lineNum">     313 </span>            :     operator&gt;=(const queue&lt;_Tp, _Seq&gt;&amp; __x, const queue&lt;_Tp, _Seq&gt;&amp; __y)
<span class="lineNum">     314 </span>            :     { return !(__x &lt; __y); }
<span class="lineNum">     315 </span>            : 
<span class="lineNum">     316 </span>            : #if __cplusplus &gt;= 201103L
<span class="lineNum">     317 </span>            :   template&lt;typename _Tp, typename _Seq&gt;
<span class="lineNum">     318 </span>            :     inline void
<span class="lineNum">     319 </span>            :     swap(queue&lt;_Tp, _Seq&gt;&amp; __x, queue&lt;_Tp, _Seq&gt;&amp; __y)
<span class="lineNum">     320 </span>            :     noexcept(noexcept(__x.swap(__y)))
<span class="lineNum">     321 </span>            :     { __x.swap(__y); }
<span class="lineNum">     322 </span>            : 
<span class="lineNum">     323 </span>            :   template&lt;typename _Tp, typename _Seq, typename _Alloc&gt;
<span class="lineNum">     324 </span>            :     struct uses_allocator&lt;queue&lt;_Tp, _Seq&gt;, _Alloc&gt;
<span class="lineNum">     325 </span>            :     : public uses_allocator&lt;_Seq, _Alloc&gt;::type { };
<span class="lineNum">     326 </span>            : #endif
<span class="lineNum">     327 </span>            : 
<span class="lineNum">     328 </span>            :   /**
<span class="lineNum">     329 </span>            :    *  @brief  A standard container automatically sorting its contents.
<span class="lineNum">     330 </span>            :    *
<span class="lineNum">     331 </span>            :    *  @ingroup sequences
<span class="lineNum">     332 </span>            :    *
<span class="lineNum">     333 </span>            :    *  @tparam _Tp  Type of element.
<span class="lineNum">     334 </span>            :    *  @tparam _Sequence  Type of underlying sequence, defaults to vector&lt;_Tp&gt;.
<span class="lineNum">     335 </span>            :    *  @tparam _Compare  Comparison function object type, defaults to 
<span class="lineNum">     336 </span>            :    *                    less&lt;_Sequence::value_type&gt;.
<span class="lineNum">     337 </span>            :    *
<span class="lineNum">     338 </span>            :    *  This is not a true container, but an @e adaptor.  It holds
<span class="lineNum">     339 </span>            :    *  another container, and provides a wrapper interface to that
<span class="lineNum">     340 </span>            :    *  container.  The wrapper is what enforces priority-based sorting 
<span class="lineNum">     341 </span>            :    *  and %queue behavior.  Very few of the standard container/sequence
<span class="lineNum">     342 </span>            :    *  interface requirements are met (e.g., iterators).
<span class="lineNum">     343 </span>            :    *
<span class="lineNum">     344 </span>            :    *  The second template parameter defines the type of the underlying
<span class="lineNum">     345 </span>            :    *  sequence/container.  It defaults to std::vector, but it can be
<span class="lineNum">     346 </span>            :    *  any type that supports @c front(), @c push_back, @c pop_back,
<span class="lineNum">     347 </span>            :    *  and random-access iterators, such as std::deque or an
<span class="lineNum">     348 </span>            :    *  appropriate user-defined type.
<span class="lineNum">     349 </span>            :    *
<span class="lineNum">     350 </span>            :    *  The third template parameter supplies the means of making
<span class="lineNum">     351 </span>            :    *  priority comparisons.  It defaults to @c less&lt;value_type&gt; but
<span class="lineNum">     352 </span>            :    *  can be anything defining a strict weak ordering.
<span class="lineNum">     353 </span>            :    *
<span class="lineNum">     354 </span>            :    *  Members not found in @a normal containers are @c container_type,
<span class="lineNum">     355 </span>            :    *  which is a typedef for the second Sequence parameter, and @c
<span class="lineNum">     356 </span>            :    *  push, @c pop, and @c top, which are standard %queue operations.
<span class="lineNum">     357 </span>            :    *
<span class="lineNum">     358 </span>            :    *  @note No equality/comparison operators are provided for
<span class="lineNum">     359 </span>            :    *  %priority_queue.
<span class="lineNum">     360 </span>            :    *
<span class="lineNum">     361 </span>            :    *  @note Sorting of the elements takes place as they are added to,
<span class="lineNum">     362 </span>            :    *  and removed from, the %priority_queue using the
<span class="lineNum">     363 </span>            :    *  %priority_queue's member functions.  If you access the elements
<span class="lineNum">     364 </span>            :    *  by other means, and change their data such that the sorting
<span class="lineNum">     365 </span>            :    *  order would be different, the %priority_queue will not re-sort
<span class="lineNum">     366 </span>            :    *  the elements for you.  (How could it know to do so?)
<span class="lineNum">     367 </span>            :   */
<span class="lineNum">     368 </span>            :   template&lt;typename _Tp, typename _Sequence = vector&lt;_Tp&gt;,
<span class="lineNum">     369 </span>            :            typename _Compare  = less&lt;typename _Sequence::value_type&gt; &gt;
<span class="lineNum">     370 </span>            :     class priority_queue
<span class="lineNum">     371 </span>            :     {
<span class="lineNum">     372 </span>            :       // concept requirements
<span class="lineNum">     373 </span>            :       typedef typename _Sequence::value_type _Sequence_value_type;
<span class="lineNum">     374 </span>            :       __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
<span class="lineNum">     375 </span>            :       __glibcxx_class_requires(_Sequence, _SequenceConcept)
<span class="lineNum">     376 </span>            :       __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)
<span class="lineNum">     377 </span>            :       __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
<span class="lineNum">     378 </span>            :       __glibcxx_class_requires4(_Compare, bool, _Tp, _Tp,
<span class="lineNum">     379 </span>            :                                 _BinaryFunctionConcept)
<span class="lineNum">     380 </span>            : 
<span class="lineNum">     381 </span>            :     public:
<span class="lineNum">     382 </span>            :       typedef typename _Sequence::value_type                value_type;
<span class="lineNum">     383 </span>            :       typedef typename _Sequence::reference                 reference;
<span class="lineNum">     384 </span>            :       typedef typename _Sequence::const_reference           const_reference;
<span class="lineNum">     385 </span>            :       typedef typename _Sequence::size_type                 size_type;
<span class="lineNum">     386 </span>            :       typedef          _Sequence                            container_type;
<span class="lineNum">     387 </span>            : 
<span class="lineNum">     388 </span>            :     protected:
<span class="lineNum">     389 </span>            :       //  See queue::c for notes on these names.
<span class="lineNum">     390 </span>            :       _Sequence  c;
<span class="lineNum">     391 </span>            :       _Compare   comp;
<span class="lineNum">     392 </span>            : 
<span class="lineNum">     393 </span>            :     public:
<span class="lineNum">     394 </span>            :       /**
<span class="lineNum">     395 </span>            :        *  @brief  Default constructor creates no elements.
<span class="lineNum">     396 </span>            :        */
<span class="lineNum">     397 </span>            : #if __cplusplus &lt; 201103L
<span class="lineNum">     398 </span>            :       explicit
<span class="lineNum">     399 </span>            :       priority_queue(const _Compare&amp; __x = _Compare(),
<span class="lineNum">     400 </span>            :                      const _Sequence&amp; __s = _Sequence())
<span class="lineNum">     401 </span>            :       : c(__s), comp(__x)
<span class="lineNum">     402 </span>            :       { std::make_heap(c.begin(), c.end(), comp); }
<span class="lineNum">     403 </span>            : #else
<span class="lineNum">     404 </span>            :       explicit
<span class="lineNum">     405 </span>            :       priority_queue(const _Compare&amp; __x,
<span class="lineNum">     406 </span>            :                      const _Sequence&amp; __s)
<span class="lineNum">     407 </span>            :       : c(__s), comp(__x)
<span class="lineNum">     408 </span>            :       { std::make_heap(c.begin(), c.end(), comp); }
<span class="lineNum">     409 </span>            : 
<span class="lineNum">     410 </span>            :       explicit
<span class="lineNum">     411 </span>            :       priority_queue(const _Compare&amp; __x = _Compare(),
<span class="lineNum">     412 </span>            :                      _Sequence&amp;&amp; __s = _Sequence())
<span class="lineNum">     413 </span>            :       : c(std::move(__s)), comp(__x)
<span class="lineNum">     414 </span>            :       { std::make_heap(c.begin(), c.end(), comp); }
<span class="lineNum">     415 </span>            : #endif
<span class="lineNum">     416 </span>            : 
<span class="lineNum">     417 </span>            :       /**
<span class="lineNum">     418 </span>            :        *  @brief  Builds a %queue from a range.
<span class="lineNum">     419 </span>            :        *  @param  __first  An input iterator.
<span class="lineNum">     420 </span>            :        *  @param  __last  An input iterator.
<span class="lineNum">     421 </span>            :        *  @param  __x  A comparison functor describing a strict weak ordering.
<span class="lineNum">     422 </span>            :        *  @param  __s  An initial sequence with which to start.
<span class="lineNum">     423 </span>            :        *
<span class="lineNum">     424 </span>            :        *  Begins by copying @a __s, inserting a copy of the elements
<span class="lineNum">     425 </span>            :        *  from @a [first,last) into the copy of @a __s, then ordering
<span class="lineNum">     426 </span>            :        *  the copy according to @a __x.
<span class="lineNum">     427 </span>            :        *
<span class="lineNum">     428 </span>            :        *  For more information on function objects, see the
<span class="lineNum">     429 </span>            :        *  documentation on @link functors functor base
<span class="lineNum">     430 </span>            :        *  classes@endlink.
<span class="lineNum">     431 </span>            :        */
<span class="lineNum">     432 </span>            : #if __cplusplus &lt; 201103L
<span class="lineNum">     433 </span>            :       template&lt;typename _InputIterator&gt;
<span class="lineNum">     434 </span>            :         priority_queue(_InputIterator __first, _InputIterator __last,
<span class="lineNum">     435 </span>            :                        const _Compare&amp; __x = _Compare(),
<span class="lineNum">     436 </span>            :                        const _Sequence&amp; __s = _Sequence())
<span class="lineNum">     437 </span>            :         : c(__s), comp(__x)
<span class="lineNum">     438 </span>            :         {
<span class="lineNum">     439 </span>            :           __glibcxx_requires_valid_range(__first, __last);
<span class="lineNum">     440 </span>            :           c.insert(c.end(), __first, __last);
<span class="lineNum">     441 </span>            :           std::make_heap(c.begin(), c.end(), comp);
<span class="lineNum">     442 </span>            :         }
<span class="lineNum">     443 </span>            : #else
<span class="lineNum">     444 </span>            :       template&lt;typename _InputIterator&gt;
<span class="lineNum">     445 </span>            :         priority_queue(_InputIterator __first, _InputIterator __last,
<span class="lineNum">     446 </span>            :                        const _Compare&amp; __x,
<span class="lineNum">     447 </span>            :                        const _Sequence&amp; __s)
<span class="lineNum">     448 </span>            :         : c(__s), comp(__x)
<span class="lineNum">     449 </span>            :         {
<span class="lineNum">     450 </span>            :           __glibcxx_requires_valid_range(__first, __last);
<span class="lineNum">     451 </span>            :           c.insert(c.end(), __first, __last);
<span class="lineNum">     452 </span>            :           std::make_heap(c.begin(), c.end(), comp);
<span class="lineNum">     453 </span>            :         }
<span class="lineNum">     454 </span>            : 
<span class="lineNum">     455 </span>            :       template&lt;typename _InputIterator&gt;
<span class="lineNum">     456 </span>            :         priority_queue(_InputIterator __first, _InputIterator __last,
<span class="lineNum">     457 </span>            :                        const _Compare&amp; __x = _Compare(),
<span class="lineNum">     458 </span>            :                        _Sequence&amp;&amp; __s = _Sequence())
<span class="lineNum">     459 </span>            :         : c(std::move(__s)), comp(__x)
<span class="lineNum">     460 </span>            :         {
<span class="lineNum">     461 </span>            :           __glibcxx_requires_valid_range(__first, __last);
<span class="lineNum">     462 </span>            :           c.insert(c.end(), __first, __last);
<span class="lineNum">     463 </span>            :           std::make_heap(c.begin(), c.end(), comp);
<span class="lineNum">     464 </span>            :         }
<span class="lineNum">     465 </span>            : #endif
<span class="lineNum">     466 </span>            : 
<span class="lineNum">     467 </span>            :       /**
<span class="lineNum">     468 </span>            :        *  Returns true if the %queue is empty.
<span class="lineNum">     469 </span>            :        */
<span class="lineNum">     470 </span>            :       bool
<span class="lineNum">     471 </span>            :       empty() const
<span class="lineNum">     472 </span>            :       { return c.empty(); }
<span class="lineNum">     473 </span>            : 
<span class="lineNum">     474 </span>            :       /**  Returns the number of elements in the %queue.  */
<span class="lineNum">     475 </span>            :       size_type
<span class="lineNum">     476 </span>            :       size() const
<span class="lineNum">     477 </span>            :       { return c.size(); }
<span class="lineNum">     478 </span>            : 
<span class="lineNum">     479 </span>            :       /**
<span class="lineNum">     480 </span>            :        *  Returns a read-only (constant) reference to the data at the first
<span class="lineNum">     481 </span>            :        *  element of the %queue.
<span class="lineNum">     482 </span>            :        */
<span class="lineNum">     483 </span>            :       const_reference
<span class="lineNum">     484 </span>            :       top() const
<span class="lineNum">     485 </span>            :       {
<span class="lineNum">     486 </span>            :         __glibcxx_requires_nonempty();
<span class="lineNum">     487 </span>            :         return c.front();
<span class="lineNum">     488 </span>            :       }
<span class="lineNum">     489 </span>            : 
<span class="lineNum">     490 </span>            :       /**
<span class="lineNum">     491 </span>            :        *  @brief  Add data to the %queue.
<span class="lineNum">     492 </span>            :        *  @param  __x  Data to be added.
<span class="lineNum">     493 </span>            :        *
<span class="lineNum">     494 </span>            :        *  This is a typical %queue operation.
<span class="lineNum">     495 </span>            :        *  The time complexity of the operation depends on the underlying
<span class="lineNum">     496 </span>            :        *  sequence.
<span class="lineNum">     497 </span>            :        */
<span class="lineNum">     498 </span>            :       void
<span class="lineNum">     499 </span>            :       push(const value_type&amp; __x)
<span class="lineNum">     500 </span>            :       {
<span class="lineNum">     501 </span>            :         c.push_back(__x);
<span class="lineNum">     502 </span>            :         std::push_heap(c.begin(), c.end(), comp);
<span class="lineNum">     503 </span>            :       }
<span class="lineNum">     504 </span>            : 
<span class="lineNum">     505 </span>            : #if __cplusplus &gt;= 201103L
<span class="lineNum">     506 </span>            :       void
<span class="lineNum">     507 </span>            :       push(value_type&amp;&amp; __x)
<span class="lineNum">     508 </span>            :       {
<span class="lineNum">     509 </span>            :         c.push_back(std::move(__x));
<span class="lineNum">     510 </span>            :         std::push_heap(c.begin(), c.end(), comp);
<span class="lineNum">     511 </span>            :       }
<span class="lineNum">     512 </span>            : 
<span class="lineNum">     513 </span>            :       template&lt;typename... _Args&gt;
<span class="lineNum">     514 </span>            :         void
<span class="lineNum">     515 </span>            :         emplace(_Args&amp;&amp;... __args)
<span class="lineNum">     516 </span>            :         {
<span class="lineNum">     517 </span>            :           c.emplace_back(std::forward&lt;_Args&gt;(__args)...);
<span class="lineNum">     518 </span>            :           std::push_heap(c.begin(), c.end(), comp);
<span class="lineNum">     519 </span>            :         }
<span class="lineNum">     520 </span>            : #endif
<span class="lineNum">     521 </span>            : 
<span class="lineNum">     522 </span>            :       /**
<span class="lineNum">     523 </span>            :        *  @brief  Removes first element.
<span class="lineNum">     524 </span>            :        *
<span class="lineNum">     525 </span>            :        *  This is a typical %queue operation.  It shrinks the %queue
<span class="lineNum">     526 </span>            :        *  by one.  The time complexity of the operation depends on the
<span class="lineNum">     527 </span>            :        *  underlying sequence.
<span class="lineNum">     528 </span>            :        *
<span class="lineNum">     529 </span>            :        *  Note that no data is returned, and if the first element's
<span class="lineNum">     530 </span>            :        *  data is needed, it should be retrieved before pop() is
<span class="lineNum">     531 </span>            :        *  called.
<span class="lineNum">     532 </span>            :        */
<span class="lineNum">     533 </span>            :       void
<span class="lineNum">     534 </span>            :       pop()
<span class="lineNum">     535 </span>            :       {
<span class="lineNum">     536 </span>            :         __glibcxx_requires_nonempty();
<span class="lineNum">     537 </span>            :         std::pop_heap(c.begin(), c.end(), comp);
<span class="lineNum">     538 </span>            :         c.pop_back();
<span class="lineNum">     539 </span>            :       }
<span class="lineNum">     540 </span>            : 
<span class="lineNum">     541 </span>            : #if __cplusplus &gt;= 201103L
<span class="lineNum">     542 </span>            :       void
<span class="lineNum">     543 </span>            :       swap(priority_queue&amp; __pq)
<span class="lineNum">     544 </span>            :       noexcept(noexcept(swap(c, __pq.c)) &amp;&amp; noexcept(swap(comp, __pq.comp)))
<span class="lineNum">     545 </span>            :       {
<span class="lineNum">     546 </span>            :         using std::swap;
<span class="lineNum">     547 </span>            :         swap(c, __pq.c);
<span class="lineNum">     548 </span>            :         swap(comp, __pq.comp);
<span class="lineNum">     549 </span>            :       }
<span class="lineNum">     550 </span>            : #endif
<span class="lineNum">     551 </span>            :     };
<span class="lineNum">     552 </span>            : 
<span class="lineNum">     553 </span>            :   // No equality/comparison operators are provided for priority_queue.
<span class="lineNum">     554 </span>            : 
<span class="lineNum">     555 </span>            : #if __cplusplus &gt;= 201103L
<span class="lineNum">     556 </span>            :   template&lt;typename _Tp, typename _Sequence, typename _Compare&gt;
<span class="lineNum">     557 </span>            :     inline void
<span class="lineNum">     558 </span>            :     swap(priority_queue&lt;_Tp, _Sequence, _Compare&gt;&amp; __x,
<span class="lineNum">     559 </span>            :          priority_queue&lt;_Tp, _Sequence, _Compare&gt;&amp; __y)
<span class="lineNum">     560 </span>            :     noexcept(noexcept(__x.swap(__y)))
<span class="lineNum">     561 </span>            :     { __x.swap(__y); }
<span class="lineNum">     562 </span>            : 
<span class="lineNum">     563 </span>            :   template&lt;typename _Tp, typename _Sequence, typename _Compare,
<span class="lineNum">     564 </span>            :            typename _Alloc&gt;
<span class="lineNum">     565 </span>            :     struct uses_allocator&lt;priority_queue&lt;_Tp, _Sequence, _Compare&gt;, _Alloc&gt;
<span class="lineNum">     566 </span>            :     : public uses_allocator&lt;_Sequence, _Alloc&gt;::type { };
<span class="lineNum">     567 </span>            : #endif
<span class="lineNum">     568 </span>            : 
<span class="lineNum">     569 </span>            : _GLIBCXX_END_NAMESPACE_VERSION
<span class="lineNum">     570 </span>            : } // namespace
<span class="lineNum">     571 </span>            : 
<span class="lineNum">     572 </span>            : #endif /* _STL_QUEUE_H */
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.12</a></td></tr>
  </table>
  <br>

</body>
</html>
